From 7cdabb94e356864c06bf48c621d2dd386782f654 Mon Sep 17 00:00:00 2001 From: Sascha Steinbiss Date: Wed, 4 Jul 2018 23:40:50 +0200 Subject: [PATCH] Import fermi-lite_0.1-5.debian.tar.xz [dgit import tarball fermi-lite 0.1-5 fermi-lite_0.1-5.debian.tar.xz] --- TODO | 2 + changelog | 39 ++++ compat | 1 + control | 54 ++++++ copyright | 71 +++++++ install | 1 + manpages | 1 + patches/bcf_seqlib.patch | 346 +++++++++++++++++++++++++++++++++++ patches/hardening | 25 +++ patches/make_shared_lib | 40 ++++ patches/rename_bseq1_t.patch | 260 ++++++++++++++++++++++++++ patches/series | 4 + rules | 31 ++++ source/format | 1 + tests/build-lib | 19 ++ tests/control | 3 + upstream/metadata | 7 + watch | 3 + 18 files changed, 908 insertions(+) create mode 100644 TODO create mode 100644 changelog create mode 100644 compat create mode 100644 control create mode 100644 copyright create mode 100644 install create mode 100644 manpages create mode 100644 patches/bcf_seqlib.patch create mode 100644 patches/hardening create mode 100644 patches/make_shared_lib create mode 100644 patches/rename_bseq1_t.patch create mode 100644 patches/series create mode 100755 rules create mode 100644 source/format create mode 100755 tests/build-lib create mode 100644 tests/control create mode 100644 upstream/metadata create mode 100644 watch diff --git a/TODO b/TODO new file mode 100644 index 0000000..ec38be1 --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +- Add correct autopkgtests (still cloned from minimap) +- Add man page diff --git a/changelog b/changelog new file mode 100644 index 0000000..2a4d991 --- /dev/null +++ b/changelog @@ -0,0 +1,39 @@ +fermi-lite (0.1-5) unstable; urgency=medium + + [ Steffen Möller ] + * Add new d/u/metadata file + + [ Sascha Steinbiss ] + * Update Vcs-* fields with Salsa addresses. + * Bump Standards-Version. + * Remove unnecessary Testsuite field. + * Use debhelper 11. + + -- Sascha Steinbiss Wed, 04 Jul 2018 23:40:50 +0200 + +fermi-lite (0.1-4) unstable; urgency=medium + + * Upload to unstable + + -- Andreas Tille Sun, 18 Jun 2017 08:12:35 +0200 + +fermi-lite (0.1-3) experimental; urgency=medium + + * Team upload. + * Avoid name space conflict with bwa + + -- Andreas Tille Thu, 02 Feb 2017 10:59:28 +0100 + +fermi-lite (0.1-2) unstable; urgency=medium + + * Autopkgtest: build example outside of upstream source tree. + * Restrict architectures to those with SSE2 support. + See also upstream's comment at https://github.com/lh3/fermi-lite/issues/4 + + -- Sascha Steinbiss Thu, 04 Aug 2016 05:37:30 +0000 + +fermi-lite (0.1-1) unstable; urgency=low + + * Initial packaging (Closes: #832757) + + -- Sascha Steinbiss Thu, 28 Jul 2016 22:26:11 +0000 diff --git a/compat b/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/compat @@ -0,0 +1 @@ +11 diff --git a/control b/control new file mode 100644 index 0000000..8eca6cb --- /dev/null +++ b/control @@ -0,0 +1,54 @@ +Source: fermi-lite +Maintainer: Debian Med Packaging Team +Uploaders: Sascha Steinbiss +Section: science +Priority: optional +Build-Depends: debhelper (>= 11), + d-shlibs, + zlib1g-dev, + help2man +Standards-Version: 4.1.4 +Vcs-Browser: https://salsa.debian.org/med-team/fermi-lite +Vcs-Git: https://salsa.debian.org/med-team/fermi-lite.git +Homepage: https://github.com/lh3/fermi-lite + +Package: fml-asm +Architecture: any-amd64 x32 +Depends: ${misc:Depends}, + ${shlibs:Depends}, + zlib1g +Description: tool for assembling Illumina short reads in small regions + Fml-asm is a command-line tool for assembling Illumina short reads in regions + from 100bp to 10 million bp in size, based on the fermi-lite library. + It is largely a light-weight in-memory version of fermikit without + generating any intermediate files. It inherits the performance, the relatively + small memory footprint and the features of fermikit. In particular, fermi-lite + is able to retain heterozygous events and thus can be used to assemble diploid + regions for the purpose of variant calling. + +Package: libfml0 +Section: libs +Architecture: any-amd64 x32 +Depends: ${shlibs:Depends}, + ${misc:Depends}, + zlib1g +Description: library for assembling Illumina short reads in small regions + Fermi-lite is a standalone C library tool for assembling Illumina short + reads in regions from 100bp to 10 million bp in size. + . + This package contains a shared library offering the fermi-lite API to custom C + programs. + +Package: libfml-dev +Section: libdevel +Architecture: any-amd64 x32 +Depends: ${shlibs:Depends}, + ${misc:Depends}, + libfml0 (= ${binary:Version}), + zlib1g-dev +Description: development headers for libfml + Fermi-lite is a standalone C library tool for assembling Illumina short + reads in regions from 100bp to 10 million bp in size. + . + This package contains the C library headers for using libfml in custom tools, + along with a static library. diff --git a/copyright b/copyright new file mode 100644 index 0000000..0452df0 --- /dev/null +++ b/copyright @@ -0,0 +1,71 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: fermi-lite +Source: https://github.com/lh3/fermi-lite +Upstream-Contact: Heng Li + +Files: * +Copyright: © 2016 Broad Institute +License: MIT + +Files: khash.h kseq.h +Copyright: (c) 2008, 2009, 2011 Attractive Chaos +License: MIT + +Files: ksort.h +Copyright: (c) 2008, 2011 Attractive Chaos +License: MIT + +Files: kstring.h +Copyright: (c) Attractive Chaos +License: MIT + +Files: ksw.h +Copyright: (c) 2011 Attractive Chaos +License: MIT + +Files: kvec.h +Copyright: (c) 2008 Attractive Chaos +License: MIT + +Files: debian/* +Copyright: © 2016 Debian Med Packaging Team +License: GPL-3+ + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +License: GPL-3+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + diff --git a/install b/install new file mode 100644 index 0000000..4cdf840 --- /dev/null +++ b/install @@ -0,0 +1 @@ +fml-asm /usr/bin diff --git a/manpages b/manpages new file mode 100644 index 0000000..f7e585b --- /dev/null +++ b/manpages @@ -0,0 +1 @@ +*.1 diff --git a/patches/bcf_seqlib.patch b/patches/bcf_seqlib.patch new file mode 100644 index 0000000..1035478 --- /dev/null +++ b/patches/bcf_seqlib.patch @@ -0,0 +1,346 @@ +Description: Try to take over patches from libSeqLib which needs separate bfc.h + FIXME: Please check the FIXME at the end. I think I did things wrong to put a + static declaration into header file but I had no better idea to make + ec1buf_init known in libSeqLib +Author: Andreas Tille +Last-Update: Thu, 02 Feb 2017 10:57:56 +0100 + +--- a/bfc.c ++++ b/bfc.c +@@ -7,24 +7,12 @@ + #include "kmer.h" + #include "internal.h" + #include "fml.h" ++#include "bfc.h" + + /******************* + *** BFC options *** + *******************/ + +-typedef struct { +- int n_threads, q, k, l_pre; +- int min_cov; // a k-mer is considered solid if the count is no less than this +- +- int max_end_ext; +- int win_multi_ec; +- float min_trim_frac; +- +- // these ec options cannot be changed on the command line +- int w_ec, w_ec_high, w_absent, w_absent_high; +- int max_path_diff, max_heap; +-} bfc_opt_t; +- + void bfc_opt_init(bfc_opt_t *opt) + { + memset(opt, 0, sizeof(bfc_opt_t)); +@@ -46,26 +34,6 @@ void bfc_opt_init(bfc_opt_t *opt) + opt->max_heap = 100; + } + +-/********************** +- *** K-mer counting *** +- **********************/ +- +-#define CNT_BUF_SIZE 256 +- +-typedef struct { // cache to reduce locking +- uint64_t y[2]; +- int is_high; +-} insbuf_t; +- +-typedef struct { +- int k, q; +- int n_seqs; +- const fml_seq1_t *seqs; +- bfc_ch_t *ch; +- int *n_buf; +- insbuf_t **buf; +-} cnt_step_t; +- + bfc_kmer_t bfc_kmer_null = {{0,0,0,0}}; + + static int bfc_kmer_bufclear(cnt_step_t *cs, int forced, int tid) +@@ -127,34 +95,6 @@ struct bfc_ch_s *fml_count(int n, const + return cs.ch; + } + +-/*************** +- *** Correct *** +- ***************/ +- +-#define BFC_MAX_KMER 63 +-#define BFC_MAX_BF_SHIFT 37 +- +-#define BFC_MAX_PATHS 4 +-#define BFC_EC_HIST 5 +-#define BFC_EC_HIST_HIGH 2 +- +-#define BFC_EC_MIN_COV_COEF .1 +- +-/************************** +- * Sequence struct for ec * +- **************************/ +- +-#include "kvec.h" +- +-typedef struct { // NOTE: unaligned memory +- uint8_t b:3, q:1, ob:3, oq:1; +- uint8_t dummy; +- uint16_t lcov:6, hcov:6, solid_end:1, high_end:1, ec:1, absent:1; +- int i; +-} ecbase_t; +- +-typedef kvec_t(ecbase_t) ecseq_t; +- + static int bfc_seq_conv(const char *s, const char *q, int qthres, ecseq_t *seq) + { + int i, l; +@@ -264,53 +204,6 @@ uint64_t bfc_ec_best_island(int k, const + return max > 0? (uint64_t)(max_i - max - k + 1) << 32 | max_i : 0; + } + +-/******************** +- * Correct one read * +- ********************/ +- +-#include "ksort.h" +- +-#define ECCODE_MISC 1 +-#define ECCODE_MANY_N 2 +-#define ECCODE_NO_SOLID 3 +-#define ECCODE_UNCORR_N 4 +-#define ECCODE_MANY_FAIL 5 +- +-typedef struct { +- uint32_t ec_code:3, brute:1, n_ec:14, n_ec_high:14; +- uint32_t n_absent:24, max_heap:8; +-} ecstat_t; +- +-typedef struct { +- uint8_t ec:1, ec_high:1, absent:1, absent_high:1, b:4; +-} bfc_penalty_t; +- +-typedef struct { +- int tot_pen; +- int i; // base position +- int k; // position in the stack +- int32_t ecpos_high[BFC_EC_HIST_HIGH]; +- int32_t ecpos[BFC_EC_HIST]; +- bfc_kmer_t x; +-} echeap1_t; +- +-typedef struct { +- int parent, i, tot_pen; +- uint8_t b; +- bfc_penalty_t pen; +- uint16_t cnt; +-} ecstack1_t; +- +-typedef struct { +- const bfc_opt_t *opt; +- const bfc_ch_t *ch; +- kvec_t(echeap1_t) heap; +- kvec_t(ecstack1_t) stack; +- ecseq_t seq, tmp, ec[2]; +- int mode; +- ecstat_t ori_st; +-} bfc_ec1buf_t; +- + #define heap_lt(a, b) ((a).tot_pen > (b).tot_pen) + KSORT_INIT(ec, echeap1_t, heap_lt) + +@@ -567,19 +460,6 @@ ecstat_t bfc_ec1(bfc_ec1buf_t *e, char * + return s; + } + +-/******************** +- * Error correction * +- ********************/ +- +-typedef struct { +- const bfc_opt_t *opt; +- const bfc_ch_t *ch; +- bfc_ec1buf_t **e; +- int64_t n_processed; +- int n_seqs, flt_uniq; +- fml_seq1_t *seqs; +-} ec_step_t; +- + static uint64_t max_streak(int k, const bfc_ch_t *ch, const fml_seq1_t *s) + { + int i, l; +@@ -663,6 +543,18 @@ float fml_correct_core(const fml_opt_t * + return kcov; + } + ++// Added by jwala for use in libSeqLib ++void kmer_correct(ec_step_t * es, int mode, bfc_ch_t * ch) { ++ int i = 0; ++ es->e = (bfc_ec1buf_t**)calloc(es->opt->n_threads, sizeof(void*)); //jwala added cast ++ for (i = 0; i < es->opt->n_threads; ++i) ++ es->e[i] = ec1buf_init(es->opt, ch), es->e[i]->mode = mode; ++ kt_for(es->opt->n_threads, worker_ec, es, es->n_seqs); ++ for (i = 0; i < es->opt->n_threads; ++i) ++ ec1buf_destroy(es->e[i]); ++ free(es->e); ++} ++ + float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 0, n, seq); +--- /dev/null ++++ b/bfc.h +@@ -0,0 +1,153 @@ ++#ifndef AC_BFC_H__ ++#define AC_BFC_H__ ++ ++#include ++#include ++#include ++#include ++#include ++#include "htab.h" ++/* #include "kmer.h" ... this is actually included by htab.h */ ++#include "internal.h" ++#include "fml.h" ++#include "khash.h" ++ ++/* Andreas Tille : Its not clear where jwala took this from and what its purpose might be - commenting out for the moment ++#define _cnt_eq(a, b) ((a)>>14 == (b)>>14) ++#define _cnt_hash(a) ((a)>>14) ++KHASH_INIT(cnt, uint64_t, char, 0, _cnt_hash, _cnt_eq) ++typedef khash_t(cnt) cnthash_t; ++ ++struct bfc_ch_s { ++ int k; ++ cnthash_t **h; ++ // private ++ int l_pre; ++}; ++*/ ++ ++typedef struct { ++ int n_threads, q, k, l_pre; ++ int min_cov; // a k-mer is considered solid if the count is no less than this ++ ++ int max_end_ext; ++ int win_multi_ec; ++ float min_trim_frac; ++ ++ // these ec options cannot be changed on the command line ++ int w_ec, w_ec_high, w_absent, w_absent_high; ++ int max_path_diff, max_heap; ++} bfc_opt_t; ++ ++/********************** ++ *** K-mer counting *** ++ **********************/ ++ ++#define CNT_BUF_SIZE 256 ++ ++typedef struct { // cache to reduce locking ++ uint64_t y[2]; ++ int is_high; ++} insbuf_t; ++ ++typedef struct { ++ int k, q; ++ int n_seqs; ++ const fml_seq1_t *seqs; ++ bfc_ch_t *ch; ++ int *n_buf; ++ insbuf_t **buf; ++} cnt_step_t; ++ ++/*************** ++ *** Correct *** ++ ***************/ ++ ++#define BFC_MAX_KMER 63 ++#define BFC_MAX_BF_SHIFT 37 ++ ++#define BFC_MAX_PATHS 4 ++#define BFC_EC_HIST 5 ++#define BFC_EC_HIST_HIGH 2 ++ ++#define BFC_EC_MIN_COV_COEF .1 ++ ++/************************** ++ * Sequence struct for ec * ++ **************************/ ++ ++#include "kvec.h" ++ ++typedef struct { // NOTE: unaligned memory ++ uint8_t b:3, q:1, ob:3, oq:1; ++ uint8_t dummy; ++ uint16_t lcov:6, hcov:6, solid_end:1, high_end:1, ec:1, absent:1; ++ int i; ++} ecbase_t; ++ ++typedef kvec_t(ecbase_t) ecseq_t; ++ ++/******************** ++ * Correct one read * ++ ********************/ ++ ++#include "ksort.h" ++ ++#define ECCODE_MISC 1 ++#define ECCODE_MANY_N 2 ++#define ECCODE_NO_SOLID 3 ++#define ECCODE_UNCORR_N 4 ++#define ECCODE_MANY_FAIL 5 ++ ++typedef struct { ++ uint32_t ec_code:3, brute:1, n_ec:14, n_ec_high:14; ++ uint32_t n_absent:24, max_heap:8; ++} ecstat_t; ++ ++typedef struct { ++ uint8_t ec:1, ec_high:1, absent:1, absent_high:1, b:4; ++} bfc_penalty_t; ++ ++typedef struct { ++ int tot_pen; ++ int i; // base position ++ int k; // position in the stack ++ int32_t ecpos_high[BFC_EC_HIST_HIGH]; ++ int32_t ecpos[BFC_EC_HIST]; ++ bfc_kmer_t x; ++} echeap1_t; ++ ++typedef struct { ++ int parent, i, tot_pen; ++ uint8_t b; ++ bfc_penalty_t pen; ++ uint16_t cnt; ++} ecstack1_t; ++ ++typedef struct { ++ const bfc_opt_t *opt; ++ const bfc_ch_t *ch; ++ kvec_t(echeap1_t) heap; ++ kvec_t(ecstack1_t) stack; ++ ecseq_t seq, tmp, ec[2]; ++ int mode; ++ ecstat_t ori_st; ++} bfc_ec1buf_t; ++ ++/******************** ++ * Error correction * ++ ********************/ ++ ++typedef struct { ++ const bfc_opt_t *opt; ++ const bfc_ch_t *ch; ++ bfc_ec1buf_t **e; ++ int64_t n_processed; ++ int n_seqs, flt_uniq; ++ fml_seq1_t *seqs; ++} ec_step_t; ++ ++void kmer_correct(ec_step_t * es, int mode, bfc_ch_t * ch); ++void bfc_opt_init(bfc_opt_t *opt); ++ ++#endif diff --git a/patches/hardening b/patches/hardening new file mode 100644 index 0000000..f3a8b5d --- /dev/null +++ b/patches/hardening @@ -0,0 +1,25 @@ +Description: add hardening flags + Adds necessary build flags for hardening. +Author: Sascha Steinbiss +Last-Update: 2016-01-08 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ +-CC= gcc +-CFLAGS= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once +-CPPFLAGS= ++CC?= gcc ++CFLAGS+= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once ++#CPPFLAGS= + INCLUDES= + OBJS= kthread.o misc.o \ + bseq.o htab.o bfc.o \ +@@ -18,7 +18,7 @@ + all:$(PROG) libfml.so.$(SONUMBER) + + fml-asm:libfml.a example.o +- $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS) ++ $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS) $(LDFLAGS) + + libfml.a:$(OBJS) + $(AR) -csru $@ $(OBJS) diff --git a/patches/make_shared_lib b/patches/make_shared_lib new file mode 100644 index 0000000..eec0747 --- /dev/null +++ b/patches/make_shared_lib @@ -0,0 +1,40 @@ +Description: build shared library + Upstream only builds a static library, this adds a shared one. +Author: Sascha Steinbiss +Last-Update: 2016-01-08 +--- a/Makefile ++++ b/Makefile +@@ -1,5 +1,5 @@ + CC= gcc +-CFLAGS= -g -Wall -O2 -Wno-unused-function #-fno-inline-functions -fno-inline-functions-called-once ++CFLAGS= -g -Wall -O2 -fPIC #-fno-inline-functions -fno-inline-functions-called-once + CPPFLAGS= + INCLUDES= + OBJS= kthread.o misc.o \ +@@ -8,13 +8,14 @@ + unitig.o mag.o bubble.o ksw.o + PROG= fml-asm + LIBS= -lm -lz -lpthread ++SONUMBER=0 + + .SUFFIXES:.c .o + + .c.o: + $(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $< -o $@ + +-all:$(PROG) ++all:$(PROG) libfml.so.$(SONUMBER) + + fml-asm:libfml.a example.o + $(CC) $(CFLAGS) $^ -o $@ -L. -lfml $(LIBS) +@@ -22,6 +23,10 @@ + libfml.a:$(OBJS) + $(AR) -csru $@ $(OBJS) + ++libfml.so.$(SONUMBER): $(OBJS) ++ $(CC) -shared -o $@ $(OBJS) -fPIC -Wl,-soname,libfml.so.$(SONUMBER) $(LIBS) $(LDFLAGS) ++ ++ + clean: + rm -fr gmon.out *.o ext/*.o a.out $(PROG) *~ *.a *.dSYM session* + diff --git a/patches/rename_bseq1_t.patch b/patches/rename_bseq1_t.patch new file mode 100644 index 0000000..ea403bb --- /dev/null +++ b/patches/rename_bseq1_t.patch @@ -0,0 +1,260 @@ +Description: Avoid name space conflict with bwa +Bug-Upstream: https://github.com/lh3/fermi-lite/issues/5 +Author: Andreas Tille +Last-Update: Thu, 02 Feb 2017 10:57:56 +0100 + +--- a/bfc.c ++++ b/bfc.c +@@ -60,7 +60,7 @@ typedef struct { // cache to reduce lock + typedef struct { + int k, q; + int n_seqs; +- const bseq1_t *seqs; ++ const fml_seq1_t *seqs; + bfc_ch_t *ch; + int *n_buf; + insbuf_t **buf; +@@ -97,7 +97,7 @@ static void bfc_kmer_insert(cnt_step_t * + static void worker_count(void *_data, long k, int tid) + { + cnt_step_t *cs = (cnt_step_t*)_data; +- const bseq1_t *s = &cs->seqs[k]; ++ const fml_seq1_t *s = &cs->seqs[k]; + int i, l; + bfc_kmer_t x = bfc_kmer_null; + uint64_t qmer = 0, mask = (1ULL<k) - 1; +@@ -111,7 +111,7 @@ static void worker_count(void *_data, lo + } + } + +-struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads) ++struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads) + { + int i; + cnt_step_t cs; +@@ -577,10 +577,10 @@ typedef struct { + bfc_ec1buf_t **e; + int64_t n_processed; + int n_seqs, flt_uniq; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + } ec_step_t; + +-static uint64_t max_streak(int k, const bfc_ch_t *ch, const bseq1_t *s) ++static uint64_t max_streak(int k, const bfc_ch_t *ch, const fml_seq1_t *s) + { + int i, l; + uint64_t max = 0, t = 0; +@@ -602,7 +602,7 @@ static uint64_t max_streak(int k, const + static void worker_ec(void *_data, long k, int tid) + { + ec_step_t *es = (ec_step_t*)_data; +- bseq1_t *s = &es->seqs[k]; ++ fml_seq1_t *s = &es->seqs[k]; + if (es->flt_uniq) { + uint64_t max; + max = max_streak(es->opt->k, es->ch, s); +@@ -624,7 +624,7 @@ static void worker_ec(void *_data, long + } else bfc_ec1(es->e[tid], s->seq, s->qual); + } + +-float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, bseq1_t *seq) ++float fml_correct_core(const fml_opt_t *opt, int flt_uniq, int n, fml_seq1_t *seq) + { + bfc_ch_t *ch; + int i, mode; +@@ -663,12 +663,12 @@ float fml_correct_core(const fml_opt_t * + return kcov; + } + +-float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq) ++float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 0, n, seq); + } + +-float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq) ++float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_correct_core(opt, 1, n, seq); + } +--- a/bseq.c ++++ b/bseq.c +@@ -6,10 +6,10 @@ + #include "kseq.h" + KSEQ_INIT(gzFile, gzread) + +-bseq1_t *bseq_read(const char *fn, int *n_) ++fml_seq1_t *fml_seq_read(const char *fn, int *n_) + { + gzFile fp; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + kseq_t *ks; + int m, n; + uint64_t size = 0; +@@ -21,10 +21,10 @@ bseq1_t *bseq_read(const char *fn, int * + + m = n = 0; seqs = 0; + while (kseq_read(ks) >= 0) { +- bseq1_t *s; ++ fml_seq1_t *s; + if (n >= m) { + m = m? m<<1 : 256; +- seqs = realloc(seqs, m * sizeof(bseq1_t)); ++ seqs = realloc(seqs, m * sizeof(fml_seq1_t)); + } + s = &seqs[n]; + s->seq = strdup(ks->seq.s); +--- a/misc.c ++++ b/misc.c +@@ -40,7 +40,7 @@ void fml_opt_init(fml_opt_t *opt) + opt->mag_opt.flag = MAG_F_NO_SIMPL; + } + +-void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs) ++void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs) + { + int i, log_len; + uint64_t tot_len = 0; +@@ -62,7 +62,7 @@ static inline int is_rev_same(int l, con + return (i == l>>1); + } + +-struct rld_t *fml_fmi_gen(int n, bseq1_t *seq, int is_mt) ++struct rld_t *fml_fmi_gen(int n, fml_seq1_t *seq, int is_mt) + { + mrope_t *mr; + kstring_t str = {0,0,0}; +@@ -75,7 +75,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t + mr = mr_init(ROPE_DEF_MAX_NODES, ROPE_DEF_BLOCK_LEN, MR_SO_RCLO); + for (k = 0; k < n; ++k) { + int i; +- bseq1_t *s = &seq[k]; ++ fml_seq1_t *s = &seq[k]; + if (s->l_seq == 0) continue; + free(s->qual); + for (i = 0; i < s->l_seq; ++i) +@@ -116,7 +116,7 @@ struct rld_t *fml_fmi_gen(int n, bseq1_t + return e; + } + +-struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq) ++struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq) + { + return fml_fmi_gen(n, seq, opt->n_threads > 1? 1 : 0); + } +@@ -251,7 +251,7 @@ void fml_utg_destroy(int n, fml_utg_t *u + + #define MAG_MIN_NSR_COEF .1 + +-fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, bseq1_t *seqs, int *n_utg) ++fml_utg_t *fml_assemble(const fml_opt_t *opt0, int n_seqs, fml_seq1_t *seqs, int *n_utg) + { + rld_t *e; + mag_t *g; +--- a/example.c ++++ b/example.c +@@ -7,7 +7,7 @@ int main(int argc, char *argv[]) + { + fml_opt_t opt; + int c, n_seqs, n_utg; +- bseq1_t *seqs; ++ fml_seq1_t *seqs; + fml_utg_t *utg; + + fml_opt_init(&opt); +@@ -34,7 +34,7 @@ int main(int argc, char *argv[]) + fprintf(stderr, " -A discard heterozygotes (apply this to assemble bacterial genomes)\n"); + return 1; + } +- seqs = bseq_read(argv[optind], &n_seqs); ++ seqs = fml_seq_read(argv[optind], &n_seqs); + utg = fml_assemble(&opt, n_seqs, seqs, &n_utg); + fml_utg_print(n_utg, utg); + fml_utg_destroy(n_utg, utg); +--- a/internal.h ++++ b/internal.h +@@ -12,7 +12,7 @@ extern "C" { + void kt_for(int n_threads, void (*func)(void*,long,int), void *data, long n); + void seq_reverse(int l, unsigned char *s); + void seq_revcomp6(int l, unsigned char *s); +-struct bfc_ch_s *fml_count(int n, const bseq1_t *seq, int k, int q, int l_pre, int n_threads); ++struct bfc_ch_s *fml_count(int n, const fml_seq1_t *seq, int k, int q, int l_pre, int n_threads); + + #ifdef __cplusplus + } +--- a/fml.h ++++ b/fml.h +@@ -8,7 +8,7 @@ + typedef struct { + int32_t l_seq; + char *seq, *qual; +-} bseq1_t; ++} fml_seq1_t; + + #define MAG_F_AGGRESSIVE 0x20 + #define MAG_F_NO_SIMPL 0x80 +@@ -60,7 +60,7 @@ extern "C" { + * + * @return array of sequences + */ +-bseq1_t *bseq_read(const char *fn, int *n); ++fml_seq1_t *fml_seq_read(const char *fn, int *n); + + /** + * Initialize default parameters +@@ -79,7 +79,7 @@ void fml_opt_init(fml_opt_t *opt); + * + * @return array of unitigs + */ +-fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, bseq1_t *seqs, int *n_utg); ++fml_utg_t *fml_assemble(const fml_opt_t *opt, int n_seqs, fml_seq1_t *seqs, int *n_utg); + + /** + * Free unitigs +@@ -100,7 +100,7 @@ void fml_utg_destroy(int n_utg, fml_utg_ + * @param n_seqs number of sequences + * @param seqs array of sequences + */ +-void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const bseq1_t *seqs); ++void fml_opt_adjust(fml_opt_t *opt, int n_seqs, const fml_seq1_t *seqs); + + /** + * Error correction +@@ -111,8 +111,8 @@ void fml_opt_adjust(fml_opt_t *opt, int + * + * @return k-mer coverage + */ +-float fml_correct(const fml_opt_t *opt, int n, bseq1_t *seq); +-float fml_fltuniq(const fml_opt_t *opt, int n, bseq1_t *seq); ++float fml_correct(const fml_opt_t *opt, int n, fml_seq1_t *seq); ++float fml_fltuniq(const fml_opt_t *opt, int n, fml_seq1_t *seq); + + /** + * Construct FMD-index +@@ -123,7 +123,7 @@ float fml_fltuniq(const fml_opt_t *opt, + * + * @return FMD-index + */ +-struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, bseq1_t *seq); ++struct rld_t *fml_seq2fmi(const fml_opt_t *opt, int n, fml_seq1_t *seq); + + /** + * Generate initial overlap graph +--- a/README.md ++++ b/README.md +@@ -29,11 +29,11 @@ sketch of the example: + int main(int argc, char *argv[]) + { + int i, n_seqs, n_utgs; +- bseq1_t *seqs; // array of input sequences ++ fml_seq1_t *seqs; // array of input sequences + fml_utg_t *utgs; // array of output unitigs + fml_opt_t opt; + if (argc == 1) return 1; // do nothing if there is no input file +- seqs = bseq_read(argv[1], &n_seqs); // or fill the array with callers' functions ++ seqs = fml_seq_read(argv[1], &n_seqs); // or fill the array with callers' functions + fml_opt_init(&opt); // initialize parameters + utgs = fml_assemble(&opt, n_seqs, seqs, &n_utgs); // assemble! + for (i = 0; i < n_utgs; ++i) // output in fasta diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..4642b14 --- /dev/null +++ b/patches/series @@ -0,0 +1,4 @@ +make_shared_lib +hardening +rename_bseq1_t.patch +bcf_seqlib.patch diff --git a/rules b/rules new file mode 100755 index 0000000..256d4eb --- /dev/null +++ b/rules @@ -0,0 +1,31 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow + +%: + dh $@ + +override_dh_auto_clean: + dh_auto_clean + rm -f fml-asm.1 + +override_dh_auto_install: + ln -s libfml.so.* libfml.so + d-shlibmove --commit \ + --multiarch \ + --devunversioned \ + --movedev "fml.h" /usr/include/ \ + --movedev "bfc.h" /usr/include/fml \ + --movedev "htab.h" /usr/include/fml \ + --movedev "kmer.h" /usr/include/fml \ + --movedev "internal.h" /usr/include/fml \ + --movedev "khash.h" /usr/include/fml \ + --movedev "kvec.h" /usr/include/fml \ + --movedev "ksort.h" /usr/include/fml \ + libfml.so + +override_dh_installman: + help2man --version-string='0.1' \ + -n 'assemble Illumina short reads in small regions' \ + -N --no-discard-stderr -h '' ./fml-asm > fml-asm.1 + dh_installman diff --git a/source/format b/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/tests/build-lib b/tests/build-lib new file mode 100755 index 0000000..2fa3f3c --- /dev/null +++ b/tests/build-lib @@ -0,0 +1,19 @@ +#!/bin/sh +# autopkgtest check: Build and run a program against libfml +# Author: Sascha Steinbiss +set -e + +SRC=$(pwd)/example.c +DATADIR=$(pwd)/test +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR + +cp $SRC . +gcc -O2 -o fermi-lite example.c -lfml -lz -lm -lpthread +[ -x fermi-lite ] +echo "build: OK" + +./fermi-lite $DATADIR/MT-simu.fq.gz > out +ldd fermi-lite +echo "run: OK" diff --git a/tests/control b/tests/control new file mode 100644 index 0000000..4c0dc47 --- /dev/null +++ b/tests/control @@ -0,0 +1,3 @@ +Tests: build-lib +Depends: @, build-essential +Restrictions: allow-stderr diff --git a/upstream/metadata b/upstream/metadata new file mode 100644 index 0000000..871c366 --- /dev/null +++ b/upstream/metadata @@ -0,0 +1,7 @@ +Registry: + - Name: OMICtools + Entry: OMICS_01087 + - Name: bio.tools + Entry: flexbar + - Name: SciCrunch + Entry: SCR_013001 \ No newline at end of file diff --git a/watch b/watch new file mode 100644 index 0000000..76520e8 --- /dev/null +++ b/watch @@ -0,0 +1,3 @@ +version=3 +https://github.com/lh3/fermi-lite/releases .*/archive/v(\d[\d.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz) + -- 2.30.2